define(function(){
	function shopcar(){
		$(function(){
			$(".jian").click(function(){
				this.num = $(this).parent().find("input").attr("value");
				this.num--;
				$(this).parent().find("input").attr("value",this.num);
				this.id = $(this).parent().parent().find("h5").html();
				this._key = "com_" + this.id; 
				this.cookie = $.cookie(this._key);
				this.cook = JSON.parse(this.cookie);
				this._value = '{"name":"' + this.cook.name + '","price":'+ this.cook.price + ',"img":"'+ this.cook.img +'","num":'+ this.num +',"id":'+this.cook.id+'}';
				$.cookie(this._key,null,{expires:7,path:"/"});
				$.cookie(this._key,this._value,{expires:7,path:"/"});
				$(this).parent().parent().find("h3").html(this.cook.price*this.num)
			})
			$(".jia").click(function(){
				this.num = $(this).parent().find("input").attr("value");
				this.num++;
				$(this).parent().find("input").attr("value",this.num);
				this.id = $(this).parent().parent().find("h5").html();
				this._key = "com_" + this.id; 
				this.cookie = $.cookie(this._key);
				this.cook = JSON.parse(this.cookie);
				this._value = '{"name":"' + this.cook.name + '","price":'+ this.cook.price + ',"img":"'+ this.cook.img +'","num":'+ this.num +',"id":'+this.cook.id+'}';
				$.cookie(this._key,null,{expires:7,path:"/"});
				$.cookie(this._key,this._value,{expires:7,path:"/"});
				$(this).parent().parent().find("h3").html(this.cook.price*this.num)
			})
			$(".shop_id").click(function(){
				$(this).parent().remove();
				this.id = $(this).html();
			})
			
		})
	}
return{
	shopcar:shopcar
}
})

